<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>角色管理</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	
	<link href="<%=path %>/css/style.css" rel="stylesheet" type="text/css" />
    <!-- jqGrid 引用 -->
    <link href="<%=path %>/js/jqGrid/css/ui.jqgrid.css"  rel="stylesheet" type="text/css"/> 
    <link href="<%=path %>/js/jqGrid/css/redmond/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />
    <script src="<%=path %>/js/jqGrid/js/jquery-1.6.2.min.js" type="text/javascript"></script> 
    <script src="<%=path %>/js/jqGrid/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
    <script src="<%=path %>/js/jqGrid/js/grid.locale-cn.js" type="text/javascript"></script>  <!-- 引入这个是为了对中文的支持 --> 
    <script src="<%=path %>/js/jqGrid/js/jquery.jqGrid.min.js" type="text/javascript"></script> 

    <script src="<%=path %>/js/json2.js" type="text/javascript"></script>
    <script src="<%=path %>/js/CM.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    var gridurl = '<%=path %>/admincontrol/rolelist.do';
    $(document).ready( function() { 
       $("#gridlist").jqGrid({
            url:gridurl,
            datatype:"json",
            mtype:'POST',
            colModel:[
				{name:'id',index:'id',label:'id',width:80,hidden:true},
				{name:'rname',index:'rname',label:'角色名称',width:120},
				{name:'remark',index:'remark',label:'备注',width:120},
				 
            ],
            jsonReader: {
                page: "page",
                total: "total",
                repeatitems: false
            },
            width:1068,
            height:400,
            rownumbers: true,
            multiselect:true,
            pager: jQuery('#gridpager'),
            rowNum: 20,
            rowList: [20, 50, 100],
            sortname: 'ID',
            sortorder: 'desc',
            viewrecords: true,
            shrinkToFit:true
        }).navGrid("#gridpager", { edit: false, add: false, del: false, search: false });
    });
	window.onload = function(){
	   	scalarGrid();
	}
	window.onresize = function(){
		scalarGrid();
	}
	function scalarGrid() {
		$("#gridlist").jqGrid('setGridWidth', $(window).width()-20).jqGrid('setGridHeight',$(window).height()-100);
	}
	/* 回车触发搜索事件 */
	function f_goSearch(evt){
		var evtObj = window.event?window.event:evt;
		if(evtObj.keyCode == 13){
			f_search();
			return false;
		}
	}
	/* 搜索 */
	function f_search() {
		var objarr = ['name']; 
		var group = CM.bulidFilterGroup(objarr); 
       	$("#gridlist").jqGrid('setGridParam',{ 
           	url:gridurl,
           	postData:  {'key': $("#name").attr("value") } , //发送数据 
           	page:1
       	}).trigger("reloadGrid"); //重新载入
	}
    </script>
</head>
<body>
	  <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
	<form action="" method="post" name="mainform" id="mainform">
			<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td align="center" valign="top">
						<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
							<tr>
								<td align="center" valign="top">
									<table class="TabMain" BORDER="0" CELLPADDING="0" CELLSPACING="0"> 
										<tr><td height="5px"></td></tr>
										<tr>
											<td valign="top">
												<table width="100%" border="0" cellspacing="0" cellpadding="0">
													<tr>
														<td align="left" class="td1" style="padding-left: 10px; height: 30px; ">  
															<input name="bt_add" id="bt_add" class="b2_add" type="button" value="新增" onclick="toolbarBtnItemClick('search');" />
															<input name="bt_modify" id="bt_modify" class="b2_modify" type="button" value="修改" onclick="toolbarBtnItemClick('search');" /> 
														</td>
														<td align="left" class="td1" style="padding-left: 10px; height: 30px; ">
															关键字
															<input type="text" class="inputcom"   id="name" name="name"   onKeyDown="return f_goSearch(event)" >
															<input name="bt_search" id="bt_search" class="b2_view" type="button" value="搜索" onclick="f_goSearch();" />
														</td>
													</tr>
													<tr>
														<td align="left" colspan="2">
															<table id="gridlist"></table>
															<div id="gridpager"></div>
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>
</body>
</html>